<!DOCTYPE html>
<html lang="cs">
	<head>
		<meta charset="utf-8" />
		<title>Příklad 6-6</title>
		<meta name="author" content="Daniel Bielczyk" />
    
    <script src="libs/scanvas.js"></script>
    
	</head>
	<body style="margin: 0; padding: 0;">
		
    <div id="canvas">
		  <canvas width="400" height="400"></canvas>
    </div>
    
<script>

new sCanvas("canvas", function() {

this.rect(10, 10, 40, 40).addGroup("named").data("name", "Martin");
this.rect(60, 10, 40, 40).addGroup("named").data("name", "Alice");
this.rect(110, 10, 40, 40).addGroup("named").data("name", "Daniel");

var output = this.text("", 10, 70);

this.get("named").click(function() {
  output.val("Já jsem " + this.data("name"));
});

});

</script>
		
	</body>
</html>